$(function() {
	var _loginForm = $('#loginForm');

	//检查输入，还没应用
	function checkInput(obj) {
		if (obj.val() == '' || null) {
			$(this).css('border-color', 'red');
			return false;
		} else {
			$(this).css('border-color', '#e5e5e5');
		}
	}

	$("button[name='submitLogin']", _loginForm).click(function() {
		var _username = $("input[name='username']", _loginForm),
			_password = $("input[name='password']", _loginForm);
		//alert(_username.val());	
		//alert(_password.val());							
		$.ajax({
			type: "POST",
			url: "/Login/login",
			data: {
				"username": _username.val(),
				"password": _password.val()
			},
			success: function(data) {
				//console.log(data.info);

				if (true === data.status) {
					window.location = "/Index/index";
				} else {
					window.alert(data.info);
					return false;
				}
			},
			error: function(XMLHttpRequest, textStatus, errorThrown) {
				console.log(XMLHttpRequest);
				console.log(textStatus);
				console.log(errorThrown);
			}


		});
		return false;
	});



})